<?php

/**
 * ecshop ERP v1.0
 * ----------------------------------------------------------------------------
 * http://www.phpally.com
 * Jacklee的博客 致力于php技术
 * ----------------------------------------------------------------------------
 * 作者: Jacklee
 * 邮箱: jack349392900@gmail.com
 * 创建时间: 2013-11-18
 * 最后修改时间: 2013-11-18
 */
 
define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');
require_once(dirname(__FILE__) . '/includes/lib/lib_erp_common.php');
require_once(dirname(__FILE__) . '/includes/lib/lib_erp_warehouse.php');


if ($_REQUEST['act'] == 'set_warn_number')
{
	include('../includes/cls_json.php');
	$json  = new JSON;
	
	//检查是否有编辑仓库的权限
	if(!admin_priv('erp_warehouse_manage', '', false))
	{
		$result['error']=1;
		$result['message']=$_LANG['erp_no_permit'];
		die($json->encode($result));
	}
	//检查参数
	if(empty($_REQUEST['goods_id']))
	{
		$result['error']=2;
		$result['message']=$_LANG['erp_wrong_parameter'];
		die($json->encode($result));
	}
	
	$goods_id=intval($_REQUEST['goods_id']);
	$warn_number=intval($_REQUEST['warn_number']);
	
	$sql="update ".$ecs->table('goods')." set warn_number='".$warn_number."' where goods_id='".$goods_id."'";
	if($db->query($sql))
	{
		$result['error']=0;
		die($json->encode($result));		
	}
}

?>